<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="author" content="wangbo">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Dom</title>
</head>
<body>
  <h1 class="red" name="dom" id="h1">我是h1</h1>
  <a  class="red" name="dom" href="#">我是a</a>
  <!-- dom document object model -->
  <script>
    // dom树
    let myh1=  document.getElementById("h1")
    console.log(myh1)
    // 通过元素name 属性,来获取多个元素,返回值是数组
    let myarrdom= document.getElementsByName("dom")
    console.log(myarrdom)
    // 通过类型获取
    let myarrdom2= document.getElementsByClassName("red")
    console.log(myarrdom2)

    
  </script>
</body>
</html>